from mmcv.runner.hooks import optimizer

### Model
model = dict(
    type="AttNet",
    num_class=40,
)

### Dataset
dataset_type = 'ModelNet40'
data_root = '/home/luojiapeng/Projects/A_pointcloud/Pointnet_Pointnet2_pytorch/data/modelnet40_normal_resampled'
train_pipeline=[
    dict(type='PointSample', num_point=1024, uniform=True),
    dict(type='PointDropout', max_ratio=0.875),
    dict(type='PointScale', range=(0.8, 0.125)),
    dict(type='PointShift', range=0.1),
    dict(type='PointNoise', range=0.025),
    dict(type='PointNormalize'),
    dict(type='Transpose', keys=['points'], order=[1, 0])
]
val_pipline=[
    dict(type='PointSample', num_point=1024, uniform=True),
    dict(type='PointNormalize'),
    dict(type='Transpose', keys=['points'], order=[1, 0])
]
data = dict(
    samples_per_gpu=64,
    workers_per_gpu=8,
    train=dict(
        type=dataset_type,
        split='train',
        root=data_root,
        pipeline=train_pipeline,
        repeat=5,
    ),
    val=dict(
        type=dataset_type,
        split='test',
        root=data_root,
        pipeline=val_pipline
    ),
    test=dict(
        type=dataset_type,
        split='test',
        root=data_root,
        pipeline=val_pipline
    )
)

### Schedule
optimizer= dict(type='AdamW', lr=0.001, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(
    policy='step',
    warmup='linear',
    warmup_iters=500,
    warmup_ratio=0.001,
    gamma=0.2,
    step=[50, 100, 150],
)
runner = dict(type='EpochBasedRunner', max_epochs=200)

### Runtime
checkpoint_config = dict(interval=1, max_keep_ckpts=1)
log_config = dict(
    interval=100,
    hooks=[
        dict(type='TextLoggerHook'),
        dict(type='TensorboardLoggerHook')
    ])
custom_hooks = [dict(type='NumClassCheckHook')]

dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
